package com.base;

import java.io.InputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;

import javax.sql.DataSource;

import com.alibaba.druid.pool.DruidDataSourceFactory;

public class DbUtil
{
	private static DataSource ds = null;

	static
	{
		try
		{
			InputStream in = DbUtil.class.getClassLoader().getResourceAsStream("terminalBox.properties");
			Properties props = new Properties();
			props.load(in);
			ds = DruidDataSourceFactory.createDataSource(props);
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}

	public static Connection openConnection() throws SQLException
	{
		return ds.getConnection();
	}
}
